#include <EXTERN.h>
#include <perl.h>

int main(int argc, char** argv, char** env) {
   PerlInterpreter *my_perl;
   char *string = "foo is foo";
   char *switches[] = {"", "-e", "0"};

   my_perl = perl_alloc();
   perl_construct(my_perl);
   perl_parse(my_perl, NULL, 3, switches, (char**)NULL);
   perl_run(my_perl);

   printf("string is '%s'\n", string);
   substitute(&string, "foo", "bar", NULL);
   printf("string is now '%s'\n", string);

   perl_destruct(my_perl);
   perl_free(my_perl);
}
